<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/Kongshop.css" rel="stylesheet" />
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<!-- 引入组件 -->
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../../js/ajax.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/fanhui.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			body {
				background-color: #E5E5E5;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<header>
					<van-nav-bar @click-left="onClickLeft" style="background-color: red;">
						<van-icon slot="left" name="arrow-left" color="white"></van-icon>
						<label slot="title" style="color: white;">我的收藏</label>
					</van-nav-bar>
			</header>
			<section>
				<van-badge-group>
					<van-badge title="收藏列表"></van-badge>
				</van-badge-group>
				<van-row v-for="item in scsp[0]">
					<div @click="skipPd(item.GoodsId)">
						<van-card
						  :price="item.RealPrice"
						  :title="item.GoodsName"
						>
							<div slot="thumb">
								<img :src="item.GoodsImageUrl" onerror="this.src='../../img/beng-1.jpg'">
							</div>
						</van-card>
					</div>
				</van-row>
			</section>
			<footer>
				
			</footer>
			</div>
			<script>
				var newUser = localStorage.getItem("user"); //从localStorage里取数据(字符串格式)
				newUser = JSON.parse(newUser); //把字符串格式转换成Json格式
				key =newUser.Key;
				var vn=new Vue({
					el:"#app",
					data:{
						scsp:[]
					},
					created:function(){
						var _this = this;
						ajax({ //获取收藏商品
							url: "http://dsapi.ysd3g.com/api/MyGoodsCollectList",
							dataType: "jsonp",
							data: {
								p:1,
								key: key//当前用户收藏商品
							},
							success: function(res) {
								if (res.Error) {
									console.log(res);
								} else {
										var sp=_this.scsp.push(res.Data);
										console.log(_this.scsp[0]);
									console.log(res);
								}
							}
						});
						
					},
					methods:{
						skipPd(id){
							console.log(id);
							plus.webview.close(plus.webview.currentWebview(), "slide-out-left");
							plus.webview.create("../mainHtml/xq.html", "xq", {}, {
								ID: id
							}).show();
						},
						onClickLeft:function(){
							plus.webview.close(plus.webview.currentWebview(), "slide-out-left");
						}
					}
				})
			</script>
	</body>
</html>
